﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using Algorithm;
using EventBroker;

namespace Engine
{
    /// <summary>
    /// This class controls the start of the jumpers
    /// </summary>
    public class CJumperEngine
    {
        private ArrayList m_aWebPageConcreteFactories;
        private static EEngineState m_eEngineState;

        [CEventPublication("Topic:StartJumpingGroup")]
        public event EventHandler m_edStartJumpingStyleAbstractProduct;
        
        /// <summary>
        /// Construtor
        /// </summary>
        internal CJumperEngine(ArrayList aWebPageConcreteFactories_p)
        {
            m_aWebPageConcreteFactories = aWebPageConcreteFactories_p;
            m_eEngineState = EEngineState.Stop;
        }

        internal static EEngineState EngineState
        {
            get { return m_eEngineState; }
        }

        /// <summary>
        /// Start all the jumpers to crawl all its website
        /// </summary>
        public void Start()
        {
            if (m_eEngineState == EEngineState.Stop)
            {
                m_eEngineState = EEngineState.Start;

                m_edStartJumpingStyleAbstractProduct(this, EventArgs.Empty);
            }
        }
    }
}
